$(document).ready(function(){
base_url= base_url = document.URL.slice(0,document.URL.indexOf("product.jsp"));
s = location.search.split('?');
$.ajax({
				type:"get",
				url: base_url+"web/getdetailJson.action",
				asyc:true,
				data:s[1],
				dataType:"JSON",
				success:function(returnedData){
	 				var json = eval("(" + returnedData + ")"); 
	 				$('#caption').text(json.caption);
	 				document.title= json.caption;
					$('#remark').text(json.remark);
					$('#goldprice').text('￥'+json.goldPrice);
					$('#loveprice').text('￥'+json.lovePrice);
					if(json.limit=='1') //仅仅限制为贫困生
					{
						$('#limit').append('该商品仅限贫困生购买');
					}
					else if(json.limit=='2'){
						$('#limit').text('该商品仅限爱心普通人购买');
					}
					else
					{
						$('#limit').text('该商品所有人均可购买')
					}
					$('#inventory').text(json.inventory);
					if(json.inventory=='0')
					{
						$('#addtocar').empty();$('#addtocar').text("该商品库存为0，不能购买！");
					}
					$('#soretime').text(json.storeTime);
					$("#prodetail").html(json.detailPro.proState);$("#prodetail").show();
					//放大镜效果
					var path = json.picPath+'/';
					var pics = json.allPics.split('|');
					var temp = '<a id="bigImg" href="'+path+pics[0]+'" class="jqzoom"><img id="midImg" alt="奥尼菲特女士浅灰色美体裤" src="'+path+pics[0]+'" class="Picture220" width="349"/>';
					//alert(temp);
					$('#Product_BigImage').html(temp);
					$('#Product_BigImage').show();
					var result='';
					for(i=0;i<pics.length;i++)
						{
							result +='<li class="moveUnit"><a href="javascript:void(0)" title="" class="currentItem"><img src="'+path+pics[i]+'" alt="" ref1="'+path+pics[i]+'" ref2="'+path+pics[i]+'" onmouseover="Biz.Product.Product.ChangePic(this);" class="Picture40"/></a></li>';
						}
					$('#allpics').html(result);$('#allpics').show();
					initBigImge();//初始化放大镜效果	
					
				},
			error:function()
			 {
				alert('ajax执行错误！');
			 }
			});
});
function initBigImge(){
	// 加载放大镜效果
	Biz.Product.Product.turn();
    Biz.Product.Product.turn2();
    Biz.Common.TabCtrl.tabs("tab");
	Biz.Common.TabCtrl.tabs("tempTab");
	Biz.Common.MoveCtrl.iniUnit('scroll', 'thumList', 4, 1);
	Biz.Common.MoveCtrl.iniUnit('gift', 'gift_1', 3, 1);
    Biz.Common.MoveCtrl.iniUnit('congener', 'congener_1', 3, 1);
    Biz.Common.TableCtrl.odd();	
    Biz.Product.Product.InitSpecialTable();
    Biz.Product.Product.InitAlsoBuy();
	//Click out event!
	$("#backgroundPopup").click(function(){
		Biz.Common.PopCtrl.disablePopup();
		});
		
	//Press Escape event!
	$(document).keypress(function(e){
		if(e.keyCode==27 && popupStatus==1){
			Biz.Common.PopCtrl.disablePopup();
		}
	});
	
    var options = {
    zoomWidth: 400,
    zoomHeight: 350,
        xOffset: 20,
        yOffset: -15,
        title : false,
		showEffect:"fadein",
		hideEffect:"fadeout",
        position: "right" 
	}
	$(".jqzoom").jqzoom(options);	
	Biz.Product.ProductDetail.Delay('44891','健康休闲');
}